home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / LITTLE / P3SRC.ZIP / ATARI / POVRAY.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-21  |  11.4 KB  |  421 lines

  1. /****************************************************************************
  2. *                   povray.h
  3. *
  4. *  This module contains all defines, typedefs, and prototypes for POVRAY.C.
  5. *
  6. *  from Persistence of Vision(tm) Ray Tracer
  7. *  Copyright 1996 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. *  NOTICE: This source code file is provided so that users may experiment
  10. *  with enhancements to POV-Ray and to port the software to platforms other
  11. *  than those supported by the POV-Ray Team.  There are strict rules under
  12. *  which you are permitted to use this file.  The rules are in the file
  13. *  named POVLEGAL.DOC which should be distributed with this file. If
  14. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  16. *  Forum.  The latest version of POV-Ray may be found there as well.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23.  
  24.  
  25. #ifndef POVRAY_H
  26. #define POVRAY_H
  27.  
  28. #include <time.h>
  29.  
  30. #include "atmosph.h"
  31. #include "camera.h"
  32. #include "point.h"
  33. #include "render.h"
  34.  
  35.  
  36. /*****************************************************************************
  37. * Global preprocessor defines
  38. ******************************************************************************/
  39.  
  40. #define MAX_LIBRARIES 64
  41.  
  42. #define STAGE_STARTUP         0  /* set in POVRAY.C */
  43. #define STAGE_BANNER          1  /* set in POVRAY.C */
  44. #define STAGE_INIT            2  /* set in POVRAY.C */
  45. #define STAGE_ENVIRONMENT     3  /* set in POVRAY.C */
  46. #define STAGE_COMMAND_LINE    4  /* set in POVRAY.C */
  47. #define STAGE_FILE_INIT       5  /* set in POVRAY.C */
  48. #define STAGE_PARSING         7  /* set in PARSE.C */
  49. #define STAGE_CONTINUING      8  /* set in POVRAY.C */
  50. #define STAGE_RENDERING       9  /* set in POVRAY.C */
  51. #define STAGE_SHUTDOWN       10  /* set in POVRAY.C */
  52. #define STAGE_INI_FILE       11  /* set in POVRAY.C */
  53. #define STAGE_CLEANUP_PARSE  12  /* set in PARSE.C */
  54. #define STAGE_SLAB_BUILDING  13  /* set in POVRAY.C */
  55. #define STAGE_TOKEN_INIT     14  /* set in TOKENIZE.C */
  56. #define STAGE_INCLUDE_ERR    15  /* set in TOKENIZE.C */
  57. #define STAGE_FOUND_INSTEAD  16  /* set in TOKENIZE.C */
  58.  
  59. #define DISPLAY           0x000001L
  60. #define VERBOSE           0x000002L
  61. #define DISKWRITE         0x000004L
  62. #define PROMPTEXIT        0x000008L
  63. #define ANTIALIAS         0x000010L
  64. #define RGBSEPARATE       0x000020L
  65. #define EXITENABLE        0x000040L
  66. #define CONTINUE_TRACE    0x000080L
  67. #define BUFFERED_OUTPUT   0x000100L
  68. #define JITTER            0x000200L
  69. #define PREVIEW           0x000400L
  70. #define SPLIT_UNION       0x000800L
  71. #define USE_VISTA_BUFFER  0x001000L
  72. #define USE_LIGHT_BUFFER  0x002000L
  73. #define USE_VISTA_DRAW    0x004000L
  74. #define REMOVE_BOUNDS     0x008000L
  75. #define CYCLIC_ANIMATION  0x010000L
  76. #define OUTPUT_ALPHA      0x020000L
  77. #define HF_GRAY_16        0x040000L
  78. #define GAMMA_CORRECT     0x080000L
  79. #define RADIOSITY         0x100000L
  80.  
  81. #define Q_FULL_AMBIENT 0x000001L
  82. #define Q_QUICKC       0x000002L
  83. #define Q_SHADOW       0x000004L
  84. #define Q_AREA_LIGHT   0x000008L
  85. #define Q_REFRACT      0x000010L
  86. #define Q_REFLECT      0x000020L
  87. #define Q_NORMAL       0x000040L
  88. #define Q_VOLUME       0x000080L
  89.  
  90.  
  91. #define QUALITY_0  Q_QUICKC+Q_FULL_AMBIENT
  92. #define QUALITY_1  QUALITY_0
  93. #define QUALITY_2  QUALITY_1-Q_FULL_AMBIENT
  94. #define QUALITY_3  QUALITY_2
  95. #define QUALITY_4  QUALITY_3+Q_SHADOW
  96. #define QUALITY_5  QUALITY_4+Q_AREA_LIGHT
  97. #define QUALITY_6  QUALITY_5-Q_QUICKC+Q_REFRACT
  98. #define QUALITY_7  QUALITY_6
  99. #define QUALITY_8  QUALITY_7+Q_REFLECT+Q_NORMAL
  100. #define QUALITY_9  QUALITY_8+Q_VOLUME
  101.  
  102.  
  103. /*****************************************************************************
  104. * Global typedefs
  105. ******************************************************************************/
  106.  
  107. typedef struct Frame_Struct FRAME;
  108.  
  109. struct Frame_Struct
  110. {
  111.   CAMERA *Camera;
  112.   int Screen_Height, Screen_Width; /* OPTIONS */
  113.   int Number_Of_Light_Sources;
  114.   LIGHT_SOURCE *Light_Sources;
  115.   OBJECT *Objects;
  116.   DBL Atmosphere_IOR, Antialias_Threshold;
  117.   COLOUR Background_Colour;
  118.   COLOUR Ambient_Light;
  119.   COLOUR Irid_Wavelengths;
  120.   ATMOSPHERE *Atmosphere;
  121.   FOG *Fog;
  122.   RAINBOW *Rainbow;
  123.   SKYSPHERE *Skysphere;
  124. };
  125.  
  126. typedef enum STATS
  127. {
  128.   /* Computations are performed on these three */
  129.   Number_Of_Pixels = 0,
  130.   Number_Of_Pixels_Supersampled,
  131.   Number_Of_Samples,
  132.   Number_Of_Rays,
  133.   Calls_To_DNoise,
  134.   Calls_To_Noise,
  135.   ADC_Saves,
  136.  
  137.   /* objects */
  138.   Bounding_Region_Tests,
  139.   Bounding_Region_Tests_Succeeded,
  140.   Clipping_Region_Tests,
  141.   Clipping_Region_Tests_Succeeded,
  142.   Istack_overflows,
  143.  
  144.   Ray_Bicubic_Tests,
  145.   Ray_Bicubic_Tests_Succeeded,
  146.   Ray_Blob_Tests,
  147.   Ray_Blob_Tests_Succeeded,
  148.   Blob_Element_Tests,
  149.   Blob_Element_Tests_Succeeded,
  150.   Blob_Bound_Tests,
  151.   Blob_Bound_Tests_Succeeded,
  152.   Ray_Box_Tests,
  153.   Ray_Box_Tests_Succeeded,
  154.   Ray_Cone_Tests,
  155.   Ray_Cone_Tests_Succeeded,
  156.   Ray_Disc_Tests,
  157.   Ray_Disc_Tests_Succeeded,
  158.   Ray_HField_Tests,
  159.   Ray_HField_Tests_Succeeded,
  160.   Ray_HField_Box_Tests,
  161.   Ray_HField_Box_Tests_Succeeded,
  162.   Ray_HField_Triangle_Tests,
  163.   Ray_HField_Triangle_Tests_Succeeded,
  164.   Ray_HField_Block_Tests,
  165.   Ray_HField_Block_Tests_Succeeded,
  166.   Ray_HField_Cell_Tests,
  167.   Ray_HField_Cell_Tests_Succeeded,
  168.   Ray_Fractal_Tests,
  169.   Ray_Fractal_Tests_Succeeded,
  170.   Ray_Lathe_Tests,
  171.   Ray_Lathe_Tests_Succeeded,
  172.   Lathe_Bound_Tests,
  173.   Lathe_Bound_Tests_Succeeded,
  174.   Ray_Mesh_Tests,
  175.   Ray_Mesh_Tests_Succeeded,
  176.   Ray_Plane_Tests,
  177.   Ray_Plane_Tests_Succeeded,
  178.   Ray_Poly_Tests,
  179.   Ray_Poly_Tests_Succeeded,
  180.   Ray_Polygon_Tests,
  181.   Ray_Polygon_Tests_Succeeded,
  182.   Ray_Prism_Tests,
  183.   Ray_Prism_Tests_Succeeded,
  184.   Prism_Bound_Tests,
  185.   Prism_Bound_Tests_Succeeded,
  186.   Ray_Quadric_Tests,
  187.   Ray_Quadric_Tests_Succeeded,
  188.   Ray_Sor_Tests,
  189.   Ray_Sor_Tests_Succeeded,
  190.   Sor_Bound_Tests,
  191.   Sor_Bound_Tests_Succeeded,
  192.   Ray_Sphere_Tests,
  193.   Ray_Sphere_Tests_Succeeded,
  194.   Ray_Torus_Tests,
  195.   Ray_Torus_Tests_Succeeded,
  196.   Torus_Bound_Tests,
  197.   Torus_Bound_Tests_Succeeded,
  198.   Ray_CSG_Intersection_Tests,
  199.   Ray_CSG_Intersection_Tests_Succeeded,
  200.   Ray_CSG_Merge_Tests,
  201.   Ray_CSG_Merge_Tests_Succeeded,
  202.   Ray_CSG_Union_Tests,
  203.   Ray_CSG_Union_Tests_Succeeded,
  204.   Ray_Triangle_Tests,
  205.   Ray_Triangle_Tests_Succeeded,
  206.   Ray_TTF_Tests,
  207.   Ray_TTF_Tests_Succeeded,
  208.   Ray_Superellipsoid_Tests,
  209.   Ray_Superellipsoid_Tests_Succeeded,
  210.   Atmosphere_Samples,
  211.   Atmosphere_Supersamples,
  212.  
  213.   Reflected_Rays_Traced,
  214.   Refracted_Rays_Traced,
  215.   Transmitted_Rays_Traced,
  216.   Shadow_Cache_Hits,
  217.   Shadow_Rays_Succeeded,
  218.   Shadow_Ray_Tests,
  219.  
  220.   nChecked,
  221.   nEnqueued,
  222.   totalQueues,
  223.   totalQueueResets,
  224.   totalQueueResizes,
  225.   Polynomials_Tested,
  226.   Roots_Eliminated,
  227.   VBuffer_Tests,
  228.   VBuffer_Tests_Succeeded,
  229.   LBuffer_Tests,
  230.   LBuffer_Tests_Succeeded,
  231.  
  232.   Halo_Samples,
  233.   Halo_Supersamples,
  234.   Halo_Rays_Traced,
  235.  
  236. #if defined(MEM_STATS)
  237.   MemStat_Smallest_Alloc,
  238.   MemStat_Largest_Alloc,
  239.   MemStat_Largest_Mem_Usage,
  240. #if (MEM_STATS>=2)
  241.   MemStat_Total_Allocs,
  242.   MemStat_Total_Frees,
  243. #endif
  244. #endif
  245.  
  246.   /* Must be the last */
  247.   MaxStat
  248.  
  249. } Stats;
  250.  
  251.  
  252. typedef enum shelltype
  253.  {
  254.    PRE_SCENE_SHL = 0,
  255.    PRE_FRAME_SHL,
  256.    POST_FRAME_SHL,
  257.    POST_SCENE_SHL,
  258.    USER_ABORT_SHL,
  259.    FATAL_SHL,
  260.    MAX_SHL /* Must be last */
  261.  } SHELLTYPE;
  262.  
  263. typedef enum shellret
  264. {
  265.   IGNORE_RET = 0,
  266.   QUIT_RET,
  267.   USER_RET,
  268.   FATAL_RET,
  269.   SKIP_ONCE_RET,
  270.   ALL_SKIP_RET
  271. } SHELLRET;
  272.  
  273. typedef struct shelldata
  274.  {
  275.    SHELLRET Ret;
  276.    int Inverse;
  277.    char Command[POV_MAX_CMD_LENGTH];
  278.  } SHELLDATA;
  279.  
  280. typedef struct OPTIONS_STRUCT
  281. {
  282.   int File_Buffer_Size;
  283.   unsigned long Options;
  284.   char DisplayFormat;
  285.   char PaletteOption;
  286.  
  287.   char OutputFormat;
  288.   int OutputQuality;
  289.   char Input_File_Name[FILE_NAME_LENGTH];
  290.   char Output_File_Name[FILE_NAME_LENGTH];
  291.   char Output_Path[FILE_NAME_LENGTH];
  292.   char Output_Numbered_Name[FILE_NAME_LENGTH];
  293.   char Scene_Name[FILE_NAME_LENGTH];
  294.   DBL DisplayGamma;
  295.   DBL GammaFactor;
  296.  
  297.   unsigned long Quality_Flags;
  298.  
  299.   long AntialiasDepth;
  300.   DBL Antialias_Threshold;
  301.  
  302.   DBL JitterScale;
  303.  
  304.   int Abort_Test_Counter;
  305.  
  306.   char *Library_Paths[MAX_LIBRARIES];
  307.   int Library_Path_Index;
  308.  
  309.   int First_Column, Last_Column;
  310.   DBL First_Column_Percent, Last_Column_Percent;
  311.  
  312.   int First_Line, Last_Line;
  313.   DBL First_Line_Percent, Last_Line_Percent;
  314.  
  315.   /* Parse */
  316.   DBL Language_Version;
  317.  
  318.   unsigned Use_Slabs;
  319.   long BBox_Threshold;
  320.  
  321.   int Quality;
  322.  
  323.   int PreviewGridSize_Start;   /* Mosaic Preview - Initial pixel grid size */
  324.   int PreviewGridSize_End;     /* Mosaic Preview - Ending pixel grid size */
  325.  
  326.   FRAMESEQ FrameSeq;
  327.  
  328.   /* Should STREAM PATHS go somewhere here? */
  329.  
  330.   DBL Radiosity_Brightness;
  331.   long Radiosity_Count;
  332.   DBL Radiosity_Dist_Max;
  333.   DBL Radiosity_Error_Bound;
  334.   DBL Radiosity_Gray;  /* degree to which gathered light is grayed */
  335.   DBL Radiosity_Low_Error_Factor;
  336.   DBL Radiosity_Min_Reuse;
  337.   long Radiosity_Nearest_Count;
  338.   int Radiosity_Recursion_Limit;
  339.   long Radiosity_Quality;  /* Q-flag value for light gathering */
  340.   int Radiosity_File_ReadOnContinue;
  341.   int Radiosity_File_SaveWhileRendering;
  342.   int Radiosity_File_AlwaysReadAtStart;
  343.   int Radiosity_File_KeepOnAbort;
  344.   int Radiosity_File_KeepAlways;
  345.   int Radiosity_Preview_Done;  /* used in cache file processing */
  346.  
  347.  
  348.   int histogram_x, histogram_y, histogram_on;
  349.   Histogram_Types histogram_type;
  350.   char Histogram_File_Name[FILE_NAME_LENGTH];
  351.  
  352.   SHELLDATA *Shellouts;
  353.  
  354.   char Ini_Output_File_Name[FILE_NAME_LENGTH];
  355.  
  356.   int Tracing_Method;
  357.   int Do_Stats;
  358. } Opts;
  359.  
  360. /*****************************************************************************
  361. * Global variables
  362. ******************************************************************************/
  363. extern FRAME Frame;
  364.  
  365. extern COUNTER stats[MaxStat];
  366. extern COUNTER totalstats[MaxStat];
  367.  
  368. extern time_t tstart, tstop;
  369. extern DBL tparse, trender, tparse_total, trender_total;
  370.  
  371. extern char Color_Bits;
  372.  
  373. extern int Number_Of_Files;
  374. extern Opts opts;
  375.  
  376. extern FILE *stat_file;
  377. extern FILE_HANDLE *Output_File_Handle;
  378.  
  379.  
  380. extern int Help_Available;
  381.  
  382. extern int Abort_Test_Every;
  383. extern int Display_Started;
  384. extern int Blanker_Started;
  385. extern int Stage;
  386. extern volatile int Stop_Flag;
  387. extern int pre_init_flag;
  388.  
  389. extern int Num_Echo_Lines, Echo_Line_Length;
  390. extern char *Option_String_Ptr;      
  391.  
  392. /*****************************************************************************
  393. * Global functions
  394. ******************************************************************************/
  395.  
  396. #ifdef NOCMDLINE
  397. # ifdef ALTMAIN
  398.   MAIN_RETURN_TYPE alt_main PARAMS((void));
  399. # else
  400.   MAIN_RETURN_TYPE main PARAMS((void));
  401. # endif
  402. #else
  403. # ifdef ALTMAIN
  404.   MAIN_RETURN_TYPE alt_main PARAMS((int argc, char ** argv));
  405. # else
  406.   MAIN_RETURN_TYPE main PARAMS((int argc, char ** argv));
  407. # endif
  408. #endif
  409.  
  410. int pov_stricmp PARAMS((char *s1,char *s2));
  411. void close_all PARAMS((void));
  412. void POV_Std_Split_Time PARAMS((DBL time_dif,unsigned long *hrs,unsigned long *mins,DBL *secs));
  413. FILE *Locate_File PARAMS((char *filename, char *mode, char *ext1, char *ext2, int err_flag));
  414.  
  415. SHELLRET pov_shellout PARAMS((SHELLTYPE Type));
  416. void pre_init_povray PARAMS((void));
  417.  
  418. void POV_Split_Path PARAMS((char *s, char *p, char *f));
  419.  
  420. #endif
  421.